package com.atguigu.pratice;

import java.util.Scanner;

public class JumpTheBlock {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int N=scanner.nextInt();
        int M=scanner.nextInt();
        int res=0;
        int tmp=0;
        while(N!=M){
            for(int i=2;i<=9;i++){
                if(N%i==0){
                    if(N+(N/i)>M){
                        continue;
                    }else{
                        tmp=N/i;
                        break;
                    }
                }
            }
            if(N+tmp<M){
                N+=tmp;
                res++;
            }else if(N+tmp==M){
                res++;
                break;
            }
        }
        System.out.println(res);
    }
}
